Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VM snapshot clone and VM pvc expansion #11062

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ayush-patni
Copy link

This PR consists of two test cases resp for CNV: VM snapshot clone and VM pvc expansion.

@ayush-patni ayush-patni requested review from a team as code owners December 18, 2024 07:00
@pull-request-size pull-request-size bot added the size/L PR that changes 100-499 lines label Dec 18, 2024
Copy link

openshift-ci bot commented Dec 18, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ayush-patni

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@@ -93,6 +94,7 @@ def create_vm_workload(
access_mode=constants.ACCESS_MODE_RWX,
pvc_size="30Gi",
source_url=constants.CNV_CENTOS_SOURCE,
pvc_obj=None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parikshit also added same parameter in his PR. It will conflict. #11045

@@ -24,6 +24,7 @@
from ocs_ci.ocs.cnv.virtual_machine_instance import VirtualMachineInstance
from ocs_ci.ocs import constants, ocp
from ocs_ci.ocs.resources import pvc
from ocs_ci.ocs.resources.pvc import PVC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as parikshit PR

@@ -107,6 +109,7 @@ def create_vm_workload(
sc_name (str): The name of the storage class to use. Default is `constants.DEFAULT_CNV_CEPH_RBD_SC`.
pvc_size (str): The size of the PVC. Default is "30Gi".
source_url (str): The URL of the vm registry image. Default is `constants.CNV_CENTOS_SOURCE`
pvc_obj (obj, optional): PVC object to use existing pvc as a backend volume to VM
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

@@ -121,7 +124,12 @@ def create_vm_workload(
self._add_ssh_key_to_vm(vm_data)

if volume_interface == constants.VM_VOLUME_PVC:
self._create_vm_pvc(vm_data=vm_data)
if pvc_obj:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

@@ -280,6 +288,20 @@ def get(self, out_yaml_format=True):
resource_name=self._vm_name, out_yaml_format=out_yaml_format
)

def get_vm_pvc_obj(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

"""
Test PVC expansion for a CNV VM workload
"""
vm_obj = cnv_workload(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use multi_cnv_workload fixture once my PR get merge.

new_size = random.randint(31, 35)
log.info(vm_pvc_obj.size)
vm_pvc_obj.resize_pvc(new_size)
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

write some data after PVC expansion. and check data integrity

volume_interface=constants.VM_VOLUME_PVC,
source_url=constants.CNV_FEDORA_SOURCE,
)[-1]
vm_pvc_obj = vm_obj.get_vm_pvc_obj()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

write some data before PVC expansion.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

assert source_csum == res_csum, (
f"Failed: MD5 comparison between source {vm_obj.name} and cloned "
f"{res_vm_obj.name} VMs"
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cloning of restored PVC step is missing.

# Resize PVC to a random size between 31 and 35 GiB
new_size = random.randint(31, 35)
log.info(vm_pvc_obj.size)
vm_pvc_obj.resize_pvc(new_size)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check size is reflected on virtual machine.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are just printing here size not verifying that size is increased.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added validation in assert statement

@pull-request-size pull-request-size bot added size/M PR that changes 30-99 lines size/L PR that changes 100-499 lines and removed size/L PR that changes 100-499 lines size/M PR that changes 30-99 lines labels Dec 19, 2024
AYUSH-D-PATNI added 4 commits December 20, 2024 14:08
Signed-off-by: AYUSH-D-PATNI <[email protected]>
Signed-off-by: AYUSH-D-PATNI <[email protected]>
Signed-off-by: AYUSH-D-PATNI <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L PR that changes 100-499 lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants